package homework02;
import java.util.Random;

public class Test03 {
	public static void main(String[] args) {
		int now;
		int[] arr;
		boolean[] flag;
		arr = new int[6];
		flag = new boolean[6];
		for(int i=1;i<=5;i++)
			flag[i] = false;
		
		for(int i=1;i<=5;i++){
			now = checkFlag(flag,5);
			arr[now] = i;			
		}
		
		for(int i=1;i<=5;i++)
			System.out.print(arr[i]+" ");
	}
	
	public static int checkFlag(boolean[] flag,int maxx){
		int res;
		Random rd = new Random();
		while(true){
			res = rd.nextInt(maxx)+1;
			if(flag[res])continue;
			else break;
		}
		flag[res] = true;
		return res;
	}
}
